home *** CD-ROM | disk | FTP | other *** search
Text File | 1999-06-25 | 2.6 KB | 112 lines | [TEXT/CWIE] |
- // ===========================================================================
- // CNewCardBehavior.cp ©1999 Eric Traut
- // ===========================================================================
-
- #include "CNewCardBehavior.h"
- #include "CShadowWindow.h"
-
-
- // ---------------------------------------------------------------------------
- // • CNewCardBehavior
- // ---------------------------------------------------------------------------
-
- CNewCardBehavior::CNewCardBehavior(
- CShadowWindow & inShadowWindow)
- : COffscreenBehavior(inShadowWindow, true, true)
- {
- mLastBlitTicks = ::TickCount();
- mHOffset = 0;
- mSlideDone = false;
- }
-
-
- // ---------------------------------------------------------------------------
- // • SyncWithShadowWindow
- // ---------------------------------------------------------------------------
-
- Boolean
- CNewCardBehavior::SyncWithShadowWindow(void)
- {
- Boolean didSync;
-
- didSync = COffscreenBehavior::SyncWithShadowWindow();
-
- if (didSync)
- {
- // Recalculate our blur rect
- CWindowRecord * macWindow = mShadowWindow.GetMacWindow();
- mInvertRect = macWindow->port.portRect;
-
- mInvertRect.right -= 15;
- mInvertRect.bottom -= 15;
- mInvertRect.top += 21;
- }
-
- return didSync;
- }
-
-
- // ---------------------------------------------------------------------------
- // • RenderToGWorld
- // ---------------------------------------------------------------------------
-
- Boolean
- CNewCardBehavior::RenderToGWorld(
- StGWorldLocker & inBackingLocker,
- StGWorldLocker & inRenderingLocker)
- {
- if (!mSlideDone)
- {
- // Split the blit into two halves.
- Rect destRect;
- UInt32 gworldWidth = mGWorldRect.right - mGWorldRect.left;
-
- destRect = mGWorldRect;
- ::OffsetRect(&destRect, -mHOffset, 0);
- ::CopyBits( reinterpret_cast<BitMap *>(*inBackingLocker.GetPixMap()),
- reinterpret_cast<BitMap *>(*inRenderingLocker.GetPixMap()),
- &mGWorldRect,
- &destRect,
- srcCopy,
- NULL);
-
- destRect = mGWorldRect;
- ::OffsetRect(&destRect, gworldWidth - mHOffset, 0);
- ::CopyBits( reinterpret_cast<BitMap *>(*inBackingLocker.GetPixMap()),
- reinterpret_cast<BitMap *>(*inRenderingLocker.GetPixMap()),
- &mGWorldRect,
- &destRect,
- srcCopy,
- NULL);
-
- mHOffset += 10;
-
- if (mHOffset >= gworldWidth)
- mSlideDone = true;
- }
-
- return true;
- }
-
-
- // ---------------------------------------------------------------------------
- // • DoIdleTask
- // ---------------------------------------------------------------------------
-
- void
- CNewCardBehavior::DoIdleTask(
- Boolean inGNETime)
- {
- if (inGNETime && mSlideDone)
- {
- // Detach ourselves
- mShadowWindow.DetachBehavior();
- }
- else
- {
- COffscreenBehavior::DoIdleTask(inGNETime);
- }
- }
-
-
-